package cn.iocoder.yudao.module.ai.dal.mysql.busimodelparam;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ai.dal.dataobject.busimodelparam.BusiModelParamDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ai.controller.admin.busimodelparam.vo.*;

/**
 * 业务模型参数 Mapper
 *
 * @author gt
 */
@Mapper
public interface BusiModelParamMapper extends BaseMapperX<BusiModelParamDO> {

    default PageResult<BusiModelParamDO> selectPage(BusiModelParamPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusiModelParamDO>()
                .eqIfPresent(BusiModelParamDO::getBusiModelId, reqVO.getBusiModelId())
                .likeIfPresent(BusiModelParamDO::getParamName, reqVO.getParamName())
                .eqIfPresent(BusiModelParamDO::getParamDesc, reqVO.getParamDesc())
                .eqIfPresent(BusiModelParamDO::getParamType, reqVO.getParamType())
                .eqIfPresent(BusiModelParamDO::getNullable, reqVO.getNullable())
                .eqIfPresent(BusiModelParamDO::getDefaultValue, reqVO.getDefaultValue())
                .eqIfPresent(BusiModelParamDO::getParamInfo, reqVO.getParamInfo())
                .orderByDesc(BusiModelParamDO::getId));
    }

    default List<BusiModelParamDO> selectParams(Integer modelId,String sourceFile) {
        return selectList(new LambdaQueryWrapperX<BusiModelParamDO>()
                .eqIfPresent(BusiModelParamDO::getBusiModelId, modelId)
                .eqIfPresent(BusiModelParamDO::getSourceFile, sourceFile));

    }

}